package com.sita.bike.utils;

import com.sita.bike.rest.RestClient;
import com.sita.bike.rest.model.RestResponse;
import com.sita.bike.rest.model.request.ResStatisticsRequest;

import retrofit.Callback;
import retrofit.RetrofitError;
import retrofit.client.Response;

/**
 * Created by hongyun on 2016/4/21.
 */
public class StaticsUtils {

//    like(1)   点赞
//    visit(2)   访问量
//    share(3)  分享次数
//    videoplay(4)   视频播放次数
    private static final String TAG_SHARE = "3";
    private static final String TAG_PLAY_VIDEO = "4";

    public static void staticsShare(String resouceid) {
        final ResStatisticsRequest request = new ResStatisticsRequest();
        request.accountId = AccountUtils.getAccountID();
        request.type = TAG_SHARE;
        request.resourceId = resouceid;
        sendStatics(request);
    }

    private static void sendStatics(final ResStatisticsRequest request) {
        RestClient.getRestNormalService().resStatistics(request, new Callback<RestResponse>() {
            @Override
            public void success(RestResponse restResponse, Response response) {
                LogUtils.d("STATICS", "ok");
            }

            @Override
            public void failure(RetrofitError error) {
                LogUtils.d("STATICS", "fail");
            }
        });
    }
}
